#ifndef PUSHTRACKER_H
#define PUSHTRACKER_H

#define RAF_BUFFER_SIZE		5
#define VAL_BUFFER_SIZE		8
#define RAW_BUFFER_SIZE		25

class PushTracker
{
private:
	unsigned int Pushes;
        unsigned long distance;
        float speed;

        int initialize;

	unsigned int push_times[RAF_BUFFER_SIZE];
	unsigned int min_times[VAL_BUFFER_SIZE];
	unsigned int max_times[VAL_BUFFER_SIZE];
	float min_vals[VAL_BUFFER_SIZE];
	float max_vals[VAL_BUFFER_SIZE];
	unsigned char min_mask;
	unsigned char max_mask;
	float RAF_diff[RAF_BUFFER_SIZE];
	
	unsigned long time_buffer[RAW_BUFFER_SIZE];
	short raw_buffer[RAW_BUFFER_SIZE];
	float filtered_buffer[RAW_BUFFER_SIZE];

	float mean;
	int i;
	int PushFlag;
	float min_thresh;
	float thresh;
        float diff_thresh;

        void maxima(void);
        void minima(void);

public:        
        PushTracker();
        PushTracker(float m_thresh, float d_thresh);
        ~PushTracker();
        unsigned int GetPushes() {return Pushes;}
        unsigned int GetPushTime() {return push_times[RAF_BUFFER_SIZE-1];}
        unsigned long GetDistance() {return distance;}
        float GetSpeed() {return speed;}
        bool UpdateBuffers(unsigned long time);
};

typedef PushTracker cPushTracker_t, *cpPushTracker_t;

#endif